// pages/movieDetail/movieDetail.js
Page({
  data:{
    currentTab:0,
    winWidth:0,
    winHeight:0,
    movie: [],
    directors: [],
    casts:[],
    iwant:"我想看"
  },
  onLoad:function(e){
    var page = this;
    if(e.num == 1)
       console.log(1);
    wx.request({
      url: 'https://douban.uieee.com/v2/movie/subject/'+e.id,
      header:{'Content-Type':'json'},
      success:function(res){
        console.log(res);
        var movie = res.data;
        page.setData({movie:movie});
        page.setData({directors:movie.directors});
        page.setData({casts:movie.casts});
        wx.setNavigationBarTitle({ title: movie.title });
      }
    });
    wx.getSystemInfo({
      success: function(res) {
        console.log(res);
        page.setData({winWidth:res.windowWidth});
        page.setData({winHeight:res.windowHeight});
      },
    });
  },
  switchNav:function(e){
    var id = e.currentTarget.id;
    this.setData({currentTab:id});
  },
  oprBindTap:function(e){
    wx.navigateTo({
      url: '../iwant/iwant',
    })
  },
  oprBindTaped: function (e) {
    wx.navigateTo({
      url: '../iwanted/iwanted'
    })
  }
})